Using GitHub CLI, you can clone all your repositories at a time. You can also do this using GitHub API and Git. Here, I am following the GitHub CLI step by step.
Install Github CLI: First, you have to install Github CLI on your machine. Follow GitHub CLI installation.
Authenticate with GitHub:
[gh auth login]Â
Use this command to log in to your GitHub and follow the instructions.
Here you can follow the protocol HTTPS to do it easily.
If there is a permission issue with the directory, Follow this:
[ mkdir -p ~/my-github-repos ]
cd ~/my-github-repos
[ ls -ld ~/my-github-repos ]
[ sudo chown -R $(whoami) ~/my-github-repos ]
[ chmod u+rwx ~/my-github-repos ]
List and Clone All Repositories:
[gh repo list USERNAME --limit 100 --json nameWithOwner,sshUrl --jq '.[].sshUrl' | xargs -L1 git clone]
Use the following one-liner to list and clone all your repositories. This command fetches the repository URLs and then clones them. Change the USERNAME with yours.